Repository navigation
Show workflow code only applied signals - #436
Merged
Merged
Conversation
WorkflowContext::signals() returned every SignalReceived in the history, including signals the Server had received but not yet applied. Workflow code could act on a signal the Server later rejected, for example closing the run before a queued update was applied. A signal is now visible once it is applied (a SignalApplied event, or a SignalReceived carrying the workflow_sequence of the wait that consumed it), or when the current workflow task delivers it (resume_source_kind workflow_signal). Identity-less SignalReceived records stay visible. Message streams keep their own cursor over every message. Replay compatibility: when hiding an unapplied signal contradicts the recorded history, the Replayer replays again showing each signal received before a later recorded workflow decision; signals received after the last recorded decision stay hidden until applied. Replay fixtures cover the new path and a legacy history. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Route the signal-compatibility retry through the existing replay() entry instead of renaming its body, and split the applied-signal checks into smaller functions. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
Replace the two-pass replay fallback with the standard version marker durable-workflow.sdk-php.signals-applied-only. The worker records it the first time hiding an unapplied signal changes what signals() returns to a live decision: a call at the end of the recorded history, or the predicate of a condition wait whose outcome is not recorded. A history without the marker replays with every received signal visible. With it, live decisions and calls replayed at or after the marker's sequence use the applied-only view, and calls replayed before it keep the earlier view. The marker step is transparent to the authored command sequence, and runs that never meet an unapplied signal record nothing. Replay fixtures cover a fresh run recording the marker, a history without it, and a history with it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
rmcdaniel
added a commit
that referenced
this pull request
Nov 19, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #434.
Behaviour
WorkflowContext::signals()used to return everySignalReceivedin the history, so workflow code could act on a signal the Server had received but not applied yet, and might later reject. In the #420 cohort that closed the run before a queued update was applied.Now a signal reaches workflow code only when one of these holds:
SignalAppliedevent names itssignal_idorworkflow_command_id, or itsSignalReceivedcarries theworkflow_sequencethe Server adds once a wait has consumed it;resume_source_kind: workflow_signalwithworkflow_signal_id/workflow_command_id), since that task's completion applies it;SignalReceivednames neither a signal ID nor a command ID. Imported or synthetic histories can't show application, so these stay visible as before.Because the Server applies messages in order, an update queued before a signal is applied before workflow code can see the signal. Received-but-unapplied and rejected (
SignalRejected) signals never change a new decision. Message streams keep their own cursor over every received message and are unchanged.Replay compatibility: version marker
The applied-only view uses the standard version marker (
record_version_marker/VersionMarkerRecorded) with change IDdurable-workflow.sdk-php.signals-applied-only, version 1. There is no fallback and no second replay pass.signals()returns to a live decision. A live decision is a call at the end of the recorded history, or the predicate of a condition wait whose outcome is not recorded. The marker is sent before the commands that decision produces, and the applied-only view applies from that call on. A completed history never records it. A run that never meets an unapplied signal, or never callssignals(), records nothing.Evidence
scripts/ci/validate-regression-corpus.py --base-ref e62224clocally (status: pass, 3 new fixtures fail on base and pass here):signals-observe-only-applied.json: a fresh run with applied, delivered-by-this-task and unapplied signals records the marker and observes only the first two.signals-unapplied-legacy-history.json: no marker. A recorded decision taken from an unapplied signal replays with the earlier view, and the first live difference records the marker.signals-applied-only-marker-recorded.json: marker recorded. The applied-only view explains the recorded decision, and no new marker is sent.tests/AppliedSignalsTest.phpcovers: the WorkflowContext::signals() exposes signals the Server has not applied #434 update-before-signal ordering, rejected signals, receipt order across application kinds, a history that never reads signals replaying unchanged (no marker, no new commands), all-applied reads recording no marker, position-based selection, genuine nondeterminism reported without trying another view, and completed histories.general-sdk228-php434-*containers): full PHPUnit run, 9147 tests OK (56 skipped). PHPStan: no errors.docs/sdk-reference.mddescribe the marker rule.🤖 Generated with Claude Code